package com.pureut.production.controller;

import com.pureut.common.core.web.controller.BaseController;
import com.pureut.common.core.web.domain.AjaxResult;
import com.pureut.common.core.web.page.TableDataInfo;
import com.pureut.common.log.annotation.Log;
import com.pureut.common.log.enums.BusinessType;
import com.pureut.common.security.annotation.RequiresPermissions;
import com.pureut.production.domain.dto.RollLengthChangeDto;
import com.pureut.production.service.IRollLengthChangeService;
import com.pureut.production.domain.vo.RollLengthChangeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @Author: YSL
 * @Date: 2023-02-09 11:25:57
 * @Desc: 母卷变更Controller
 */
@RestController
@RequestMapping("/rollLengthChange")
public class RollLengthChangeController extends BaseController {

    /**
     * 卷长变更Service
     */
    @Autowired
    private IRollLengthChangeService rollLengthChangeService;

    /**
     * 查看卷长变更列表
     */
    @RequiresPermissions("productionTube:produAdm:slitting:mastervolu:list")
    @GetMapping("/list")
    public TableDataInfo selectOperationList(RollLengthChangeVo rollLengthChangeVo) {
        startPage();
        // 查询工序信息列表
        List<RollLengthChangeDto> rollLengthChangeDtos = rollLengthChangeService.selectRollLengthList(rollLengthChangeVo);
        return getDataTable(rollLengthChangeDtos);
    }

    /**
     * 新增卷长变更
     */
    @RequiresPermissions("productionTube:produAdm:slitting:mastervolu:change")
    @Log(title = "新增卷长变更", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@Validated @RequestBody RollLengthChangeVo rollLengthChangeVo) throws Exception {
        return toAjax(rollLengthChangeService.add(rollLengthChangeVo));
    }

}
